using UnityEngine;

namespace Gj
{
    public class AutoRotateHelper : NodeHelper
    {
        public float speedX;
        public float speedY;
        public float speedZ;
        public bool invert;
        private bool allow;
        private readonly bool auto = false;

        protected override BindDataType bindDataType => BindDataType.Bool;

        // Update is called once per frame
        private void Update()
        {
            if (!auto && !allow) return;
            transform.Rotate(speedX * Time.deltaTime, speedY * Time.deltaTime, speedZ * Time.deltaTime, Space.World);
        }

        protected override void BindData(bool b)
        {
            allow = invert ? !b : b;
        }
    }
}